<template>
	<view class="layout">
		<view class="xxmCustomNavNar">
			<view class="top" :style="{height:getStatusBarHeight() + 'px'}"></view>
			<view class="titleBar" :style="{height:getTitleBarHeighe() + 'px'}">
				<view class="text">{{title}}</view>
				<view class="input"  @click="onInput">
					<uni-icons color="rgba(0, 0, 0, 0.5)" size="18" type="search"></uni-icons>
					<view class="searchText" >搜索</view>
				</view>
			</view>
		</view>
		<view class="BarHeight" :style="{height:getTitleBarHeighe() + getStatusBarHeight() + 'px'}"></view>
	</view>
</template>

<script setup>
	import {getStatusBarHeight,getTitleBarHeighe} from '@/utils/system.js'
	defineProps({
		title:{
			type:String,
			default:"壁纸"
		}
	})
	//状态栏高度（刘海屏）
	// const {statusBarHeight} = uni.getSystemInfoSync()
	// //小程序胶囊按钮信息（top是胶囊按钮最上面的边距离屏幕最上方的距离，height是胶囊按钮的高度）
	// const {top,height} = uni.getMenuButtonBoundingClientRect()
	// //计算导航栏的高度让导航栏和胶囊按钮对齐
	// const titleBarHeighe = (top - statusBarHeight) * 2 + height
	
	//跳转到搜索页面
	const onInput = ()=>{
		uni.navigateTo({
			url:"/pages/search/search"
		})
	}
</script>

<style lang="scss" scoped>
.xxmCustomNavNar{
	position: fixed;
	top: 0;
	left: 0;
	z-index: 1;
	width: 100%;
	background:
	linear-gradient(to bottom, rgba(0,0,0,0) 0%, #fff 400rpx),
	linear-gradient(to right, #beecd8 20%, #f4e2d8);
	.top{
		
	}
	.titleBar{
		display: flex;
		align-items: center;
		padding: 0 30rpx;
		.text{
			font-size: 40rpx;
			font-weight: 600;
			margin-right: 30rpx;
		}
		.input{
			display: flex;
			align-items: center;
			width: 250rpx;
			height: 60rpx;
			border-radius: 80rpx;
			background: rgba(255, 255, 255, 0.5);
			color: rgba(0, 0, 0, 0.5); 
			padding: 0 20rpx;
			.searchText{
				margin-left: 10rpx;
			}
		}
	}
}

</style>